PollutionPoint = function (pointlist, ptcolor) 
{
	var point;

	var speed = 0.001;
	
	var pointindex;
	var curdir;
	var checkdir;

	this.createPoint = function()
	{
		speed = this.calLength() / 240;

		var sphere = new THREE.SphereGeometry( 0.01, 6, 6 );
		point = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( { color: ptcolor } ) );
		point.position.copy(pointlist[0]);

		pointindex = 1;
		curdir = new THREE.Vector3();
		curdir.subVectors( pointlist[pointindex], pointlist[pointindex-1] );
		curdir.normalize();

		checkdir = new THREE.Vector3();
		return point;
	}
	
	this.move = function()
	{
		point.position.x = point.position.x + curdir.x * speed;
		point.position.y = point.position.y + curdir.y * speed;
		point.position.z = point.position.z + curdir.z * speed;

		//check new pos
		checkdir.subVectors( pointlist[pointindex], point.position );
		if(curdir.dot(checkdir) < 0)
		{
			pointindex = (pointindex+1) >= pointlist.length ? 1:(pointindex+1);
			point.position.copy(pointlist[pointindex-1]);
			
			curdir.subVectors( pointlist[pointindex], pointlist[pointindex-1] );
			curdir.normalize();
		}
	}

	this.calLength = function()
	{
		var length = 0;
		for(var i = 0; i < pointlist.length - 1; i++)
		{
			length = length + pointlist[i].distanceTo(pointlist[i+1]);
		}

		return length;
	}

};
